package com.vogue.supplymall.shop.domain.mapper;

import com.vogue.supplymall.shop.domain.model.Administrativearea;
import com.vogue.supplymall.shop.domain.model.OrganShopImg;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * The interface Administrativearea mapper.
 *
 * @aouthor: zhangliang
 * @date: Create in 2017-12-19
 */
@Mapper
public interface AdministrativeareaMapper extends BaseMapper<Administrativearea, Long> {

    /**
     * Find by sys code list.
     *
     * @param level the level
     * @return the list
     */
    @Select("SELECT ad.id, ad.`name`, ad.areacode, ad.areaname, ad.pid, ad.shortname, ad.leveltype, ad.citycode, ad.zipcode, ad.mergername, ad.lng, ad.lat, ad.pinyin, ad.initial FROM administrativearea ad WHERE leveltype = #{level} AND initial IS NOT NULL and id <> 900000")
    List<Administrativearea> findAreaBylevel(Integer level);
    /**
     * 找到level等级下的所有地区信息
     */
    @Select("SELECT ad.id, ad.`name`, ad.areacode, ad.areaname, ad.pid, ad.shortname, ad.leveltype, ad.citycode, ad.zipcode, ad.mergername, ad.lng, ad.lat, ad.pinyin, ad.initial FROM administrativearea ad WHERE leveltype <= #{level} AND initial IS NOT NULL and id <> 900000")
    List<Administrativearea> findAllAreaOfMinLevel(Integer level);
}
